package com.eorchis.module.trainingneeds.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.eorchis.core.basedao.entity.impl.AbstractBaseEntity;


import org.hibernate.annotations.GenericGenerator;

import com.eorchis.core.basedao.entity.IBaseEntity;

/**
 * Title: QuestionnaireSurveyObject<br>
 * Description: 问卷调查对象表实体对象<br>
 * Company: GoldGov<br>
 * Copyright @ 2012 GoldGov .All rights reserved.<br>
 * @author HuangTF
 * @createDate 2014-02-07
 * @version $Revision$
 */
@Entity
@Table(name = "QUESTIONNAIRE_SURVEY_OBJECT")
public class QuestionnaireSurveyObject extends AbstractBaseEntity implements IBaseEntity {
	private static final long serialVersionUID = 1L;
	
	/**
	 * 调查对象类型：1：全体
	 */
	public static final Integer SURVEY_TYPE_ALL=new Integer(1);
	/**
	 * 调查对象类型：2：指定人员
	 */
	public static final Integer SURVEY_TYPE_USER=new Integer(2);
	
	private String questionnaireSurveyObjectId;//问卷调查对象ID
	private Questionnaire questionnaire;//问卷
	private String surveyObjectId;//调查对象ID，全体时置空，指定人员时为人员ID
	private Integer surveyObjectType;//调查对象类型   1：全体   2：指定人员
	private Integer writeType;//填写方式    1:学员填写   2:管理员代填  (暂时保留，以后可能会用到)

	/**
	 * 获取问卷调查对象ID
	 */	
	@Id
	@GeneratedValue(generator = "system-uuid")
	@GenericGenerator(name = "system-uuid", strategy = "uuid")
	@Column(name="QUESTIONNAIRE_SURVEY_OBJECT_ID")
	public String getQuestionnaireSurveyObjectId() {
		return questionnaireSurveyObjectId;
	}
	/**
	 * 设置问卷调查对象ID
	 */	
	public void setQuestionnaireSurveyObjectId(String questionnaireSurveyObjectId) {
		this.questionnaireSurveyObjectId = questionnaireSurveyObjectId;
	}
	/**
	 * 获取问卷
	 */	
	@ManyToOne(fetch = FetchType.LAZY, optional = true)
	@JoinColumn(name="QUESTIONNAIRE_ID")
	public Questionnaire getQuestionnaire() {
		return questionnaire;
	}
	/**
	 * 设置问卷
	 */	
	public void setQuestionnaire(Questionnaire questionnaire) {
		this.questionnaire = questionnaire;
	}
	/**
	 * 获取调查对象ID
	 */	
	@Column(name="SURVEY_OBJECT_ID")
	public String getSurveyObjectId() {
		return surveyObjectId;
	}
	/**
	 * 设置调查对象ID
	 */	
	public void setSurveyObjectId(String surveyObjectId) {
		this.surveyObjectId = surveyObjectId;
	}
	/**
	 * 获取调查对象类型
	 */	
	@Column(name="SURVEY_OBJECT_TYPE")
	public Integer getSurveyObjectType() {
		return surveyObjectType;
	}
	/**
	 * 设置调查对象类型
	 */	
	public void setSurveyObjectType(Integer surveyObjectType) {
		this.surveyObjectType = surveyObjectType;
	}
	/**
	 * 获取填写方式
	 */	
	@Column(name="WRITE_TYPE")
	public Integer getWriteType() {
		return writeType;
	}
	/**
	 * 设置填写方式
	 */	
	public void setWriteType(Integer writeType) {
		this.writeType = writeType;
	}

	/**
	 * 记录日志使用
	 */
	public String toString() {
		return "调查对象ID======>" + getSurveyObjectId()+"\n问卷======>" + getQuestionnaire()+"\n填写方式======>" + getWriteType();
	}
}
